#ifndef MODIFYPRICEDISCOUNT_H
#define MODIFYPRICEDISCOUNT_H

#include <QWidget>

class SaleDetail;
class InquireSql;

namespace Ui {
class ModifyPriceDiscount;
}

enum LastClickModifyPriceDiscount {lineEditSaleQuantity, lineEditDiscount,
                lineEditSellingPrice, lineEditSubsum, pushButtonConfirm};

class ModifyPriceDiscount : public QWidget
{
    Q_OBJECT
    
public:
    explicit ModifyPriceDiscount(QWidget *parent = 0);
    ~ModifyPriceDiscount();
    void displaySaleCommodityInformation(const SaleDetail &);
    bool eventFilter(QObject *target, QEvent *event);
//    void set_staffName();
//    void forbidModifyPriceDiscount();
    void set_forbidModifyPriceDiscount(bool forbidModifyPriceDiscount)
    {m_forbidModifyPriceDiscount = forbidModifyPriceDiscount;}
    void setMode();

signals:
    void updateSalePriceDiscount(const SaleDetail&);
    
private slots:
    void on_pushButtonQuit_clicked();

    void on_pushButtonConfirm_clicked();

    void on_lineEditSaleQuantity_textChanged(const QString &);

    void on_lineEditSellingPrice_textChanged(const QString &arg1);

    void on_lineEditDiscount_textChanged(const QString &arg1);

    void on_lineEditSubsum_editingFinished();

    void on_lineEditSellingPrice_editingFinished();

private:
    QString completionPrice(const QString &);
    Ui::ModifyPriceDiscount *ui;
    int m_lastClick;
    InquireSql *m_sql;
    bool m_forbidModifyPriceDiscount;
};

#endif // MODIFYPRICEDISCOUNT_H
